package com.qboot.common.controller;

import com.qboot.common.annotation.Log;
import com.qboot.common.entity.Result;
import com.qboot.common.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件上传
 *
 * @author Tellsea
 * @date 2022/12/27
 */
@Api(tags = "文件")
@RestController
@RequestMapping("/osslocal/file")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class FileController {

    private final FileService fileService;

    @ApiOperation("文件上传")
    @Log("文件上传")
    @PostMapping("/upload")
    public Result upload(MultipartFile file) {
        return fileService.upload(file);
    }
}
